package com.weasel.weixin.commons.message.builder.initiative;

import com.weasel.weixin.commons.message.bean.initiative.AbstractCustomInitiativeMessage;
import com.weasel.weixin.commons.service.bean.CustomService;

/**
 * Created by Dylan on 2015/10/19.
 */
public abstract class AbstractCustomInitiativeMessageBuilder<T extends AbstractCustomInitiativeMessageBuilder,M extends AbstractCustomInitiativeMessage> {

    protected AbstractCustomInitiativeMessage message;

    public AbstractCustomInitiativeMessageBuilder(AbstractCustomInitiativeMessage message) {
        this.message = message;
    }

    public T toUser(String toUser){

        message.setToUser(toUser);
        return (T)this;
    }

    public T customService(String kfAccount){

        CustomService service = new CustomService();
        service.setAccount(kfAccount);
        message.setCustomservice(service);
        return (T)this;
    }

    public M build(){
        return (M)message;
    }
}
